# -*- coding:utf 8 -*-
'''
思路：将三组数据分别添加在列表的三个元素中，下标规则是0-1-2-1-0-1-2...组号从0依次增加到最大连续减两次到最小在增加。。。
'''

class Solution(object):
    def convert(self, s, numRows):
        """
        :type s: str
        :type numRows: int
        :rtype: str
        """
        ziazag = ['' for i in range(numRows)] # 创建列表，内设num个元素
        row = 0
        step = 1
        for a in s:
            if row == 0:
                step = 1
            if row == numRows - 1:
                step = -1
            ziazag[row] += a
            row += step
        for i in range(numRows):
            print ziazag[i]
        return ''.join(ziazag)

if __name__ == '__main__':
    slove = Solution()
    s = 'PAYPALISHIRING'
    num = 3
    print slove.convert(s,num)